﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Globalization;
using System.Diagnostics;


namespace University.Workshop.ClientApp
{
    public class Luck
    {
        string result;
        int resultCard;
        char resultConsult;
        public Luck()
        { }
        
        public string IncrementCoins(string present)
        {
            result = "";
            int aux = Convert.ToInt32(present,CultureInfo.InvariantCulture);
            result = Convert.ToString(aux+100,CultureInfo.InvariantCulture);
            return result;
        }
        public string DecreaseCoins(string present)
        {
            result = "0";
            int aux = Convert.ToInt32(present,CultureInfo.InvariantCulture);
            if (aux > 0)
            {
                result = Convert.ToString(aux-100,CultureInfo.InvariantCulture);
            }

            return result;
        }
        public string GetImage
        {
            get{
                result = "";
                Random obj = new Random();
                int ran = obj.Next(1, 13);
                switch (ran)
                {
                    case 1:
                        result = "Images/uno.png";
                        break;
                    case 2:
                        result = "Images/dos.png";
                        break;
                    case 3:
                        result = "Images/tre.png";
                        break;
                    case 4:
                        result = "Images/cuatro.png";
                        break;
                    case 5:
                        result = "Images/cinco.png";
                        break;
                    case 6:
                        result = "Images/ceis.png";
                        break;
                    case 7:
                        result = "Images/ciete.png";
                        break;
                    case 8:
                        result = "Images/ocho.png";
                        break;
                    case 9:
                        result = "Images/nueve.png";
                        break;
                    case 10:
                        result = "Images/diez.png";
                        break;
                    case 11:
                        result = "Images/once.png";
                        break;
                    case 12:
                        result = "Images/doce.png";
                        break;
                    case 13:
                        result = "Images/trece.png";
                        break;
                    default:
                        result = "Images/oculto.png";
                        break;
                }
                return result;
            }
            
        }
        public int GetCard(string card)
        {
            resultCard = 0;

            switch (card)
            {
                case "Images/uno.png":
                    resultCard = 1;
                    break;
                case "Images/dos.png":
                    resultCard = 2;
                    break;
                case "Images/tre.png":
                    resultCard = 3;
                    break;
                case "Images/cuatro.png":
                    resultCard = 4;
                    break;
                case "Images/cinco.png":
                    resultCard = 5;
                    break;
                case "Images/ceis.png":
                    resultCard = 6;
                    break;
                case "Images/ciete.png":
                    resultCard = 7;
                    break;
                case "Images/ocho.png":
                    resultCard = 8;
                    break;
                case "Images/nueve.png":
                    resultCard = 9;
                    break;
                case "Images/diez.png":
                    resultCard = 10;
                    break;
                case "Images/once.png":
                    resultCard = 11;
                    break;
                case "Images/doce.png":
                    resultCard = 12;
                    break;
                case "Images/trece.png":
                    resultCard = 13;
                    break;
                default:
                    resultCard = 0;
                    break;
            }
            return resultCard;
        }
        public char Consult(int variableOne, int variableTwo, string operation)
        {
            resultConsult = 'x';
            if (operation == "mayor")
            {
                if (variableOne > variableTwo)
                {   resultConsult = 's'; }
                else
                {   resultConsult = 'n'; }
            }
            else
            {
                if (operation == "menor")
                {
                    if (variableOne < variableTwo)
                    {   resultConsult = 's'; }
                    else
                    {   resultConsult = 'n'; }
                }
                else
                {
                    if (operation == "igual")
                    {
                        if (variableOne == variableTwo)
                        {   resultConsult = 'i';   }
                        else
                        {   resultConsult = 'o';   }
                    } 
                }
            }
            return resultConsult;
        }
     }
}
